package com.ugood.utils;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class ParseParamsUtils {
	
	
	
	public static JSONObject ethParams(Integer tokenAddressId,String walletAddress) {
		JSONObject rootParam = new JSONObject();
		rootParam.put("jsonrpc", "2.0");
		rootParam.put("id", tokenAddressId);
		rootParam.put("method", "eth_getBalance");
		JSONArray param = new JSONArray();
		param.add(walletAddress);
		param.add("latest");
		rootParam.put("params", param);
		return rootParam;
	}
	
	public static JSONObject tokenParams(Integer tokenAddressId,String tokenAddress,String walletAddress) {
		JSONObject rootParam = new JSONObject();
		rootParam.put("jsonrpc", "2.0");
		rootParam.put("id", tokenAddressId);
		rootParam.put("method", "eth_call");
		JSONArray param = new JSONArray();
		JSONObject toData = new JSONObject();
		toData.put("to", tokenAddress);
		toData.put("data", ConstUtils.DATA_PREFIX+walletAddress.replaceAll(ConstUtils.PREFIX_0x, ""));
		param.add(toData);
		param.add("latest");
		rootParam.put("params", param);
		return rootParam;
	}

}
